//
//  AboutUsViewController.m
//  cityCar
//
//  Created by 刘伟 on 14-11-5.
//  Copyright (c) 2014年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "AboutUsViewController.h"

@interface AboutUsViewController ()

@end

@implementation AboutUsViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.

    [self setupView];
 
}

- (void)setupView
{
    // 屏幕宽和高
    CGFloat x = self.view.frame.size.width;
    CGFloat y = self.view.frame.size.height;
    
    self.view.backgroundColor = [WebColor whiteSmoke];
    
    
    // 顶部View
    UIView *headView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, x, 64)];
    headView.backgroundColor = [WebColor whiteSmoke];
    [self.view addSubview:headView];
    [headView release];
    
    // 标题
    UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake((x - 100) / 2, 15, 100, 50)];
    titleLabel.text = @"关于我们";
    titleLabel.textAlignment = NSTextAlignmentCenter;
    [headView addSubview:titleLabel];
    [titleLabel release];
    
    // 返回按钮
    UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
    button.frame = CGRectMake(10, 25, 30, 30);
    [button setImage:[UIImage imageNamed:@"iconfont-fanhui.png"] forState:UIControlStateNormal];
    [button addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside];
    button.tintColor = [WebColor black];
    [headView addSubview:button];
    
    // 背景图片
    UIImageView *beijingImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 64, x, y - 64)];
    beijingImageView.image = [UIImage imageNamed:@"wodebeijing.jpg"];
    [self.view addSubview:beijingImageView];
    [beijingImageView release];
    
    
    NSArray *arr = @[@"yaoge.png", @"changkuan.png", @"liuwei.jpg"];
    NSArray *arrIntro = @[@"程序猿：姜钰瑶", @"程序猿：常宽", @"程序猿：刘伟"];
    
    if (y < 481) {
        // 图标
        UIImageView *myImageView = [[UIImageView alloc] initWithFrame:CGRectMake((x - 60) / 2, 80, 60, 60)];
        myImageView.image = [UIImage imageNamed:@"都市汽车5.png"];
        [self.view addSubview:myImageView];
        [myImageView release];
        // cityCar
        UILabel *cityLabel = [[UILabel alloc] initWithFrame:CGRectMake((x - 60) / 2, 140, 60, 20)];
        cityLabel.text = @"CityCar";
        cityLabel.textAlignment = NSTextAlignmentCenter;
        [self.view addSubview:cityLabel];
        [cityLabel release];
        
        // 简介
        UILabel *headLabel = [[UILabel alloc] initWithFrame:CGRectMake((x - 260) / 2, 160, 260, 80)];
        headLabel.text = @"都市汽车, 是一款方便实用的汽车软件, 也是我们精心为广大智能手机用户打造的免费客户端应用, 里面包括资讯、车辆论坛、汽车报价等功能, 欢迎大家体验";
        headLabel.textAlignment = NSTextAlignmentCenter;
        headLabel.numberOfLines = 0;
        headLabel.font = [UIFont systemFontOfSize:14];
        [self.view addSubview:headLabel];
        [headLabel release];
        
        
        for (int i = 0; i < 3; i++) {
            UIView *myView = [[UIView alloc] initWithFrame:CGRectMake(70, 250 + i * 45, 280, 40)];
            [self.view addSubview:myView];
            [myView release];
            
            // 头像
            UIImageView *mineImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
            mineImageView.image = [UIImage imageNamed:arr[i]];
            [myView addSubview:mineImageView];
            [mineImageView release];
            
            // 简介，人名
            UILabel *mineLabel = [[UILabel alloc] initWithFrame:CGRectMake(55, 0, 150, 40)];
            mineLabel.text = arrIntro[i];
            mineLabel.textAlignment = NSTextAlignmentLeft;
            [myView addSubview:mineLabel];
            [mineLabel release];
            
        }
        
        // 感谢外援
        UILabel *thankLabel = [[UILabel alloc] initWithFrame:CGRectMake(50, self.view.frame.size.height - 83, self.view.frame.size.width - 100, 20)];
        thankLabel.text = @"特别感谢";
        thankLabel.font = [UIFont boldSystemFontOfSize:18.f];
        thankLabel.textAlignment = NSTextAlignmentCenter;
        [self.view addSubview:thankLabel];
        [thankLabel release];
        
        // 感谢外援
        UILabel *thankContentLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, self.view.frame.size.height - 63, self.view.frame.size.width - 20, 63)];
        thankContentLabel.text = @"设计狮：魏文媛\n设计狮：刘畅";
        thankContentLabel.numberOfLines = 0;
        thankContentLabel.font = [UIFont systemFontOfSize:15];
        thankContentLabel.textAlignment = NSTextAlignmentCenter;
        [self.view addSubview:thankContentLabel];
        [thankContentLabel release];

        
        
    } else {
        
        
        UIImageView *myImageView = [[UIImageView alloc] initWithFrame:CGRectMake((x - 100) / 2, 80, 100, 100)];
        myImageView.image = [UIImage imageNamed:@"都市汽车5.png"];
        [self.view addSubview:myImageView];
        [myImageView release];
        // cityCar
        UILabel *cityLabel = [[UILabel alloc] initWithFrame:CGRectMake((x - 100) / 2, 180, 100, 20)];
        cityLabel.text = @"CityCar";
        cityLabel.textAlignment = NSTextAlignmentCenter;
        [self.view addSubview:cityLabel];
        [cityLabel release];
        
        // 简介
        UILabel *headLabel = [[UILabel alloc] initWithFrame:CGRectMake((x - 260) / 2, 200, 260, 120)];
        headLabel.text = @"都市汽车, 是一款方便实用的汽车软件, 也是我们精心为广大智能手机用户打造的免费客户端应用, 里面包括资讯、车辆论坛、汽车报价等功能, 欢迎大家体验";
        headLabel.textAlignment = NSTextAlignmentCenter;
        headLabel.numberOfLines = 0;
        [self.view addSubview:headLabel];
        [headLabel release];
        
        // 开发者
        for (int i = 0; i < 3; i++) {
            UIView *myView = [[UIView alloc] initWithFrame:CGRectMake(50, 320 + i * 55, 280, 50)];
            [self.view addSubview:myView];
            [myView release];
            
            // 头像
            UIImageView *mineImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 50, 50)];
            mineImageView.image = [UIImage imageNamed:arr[i]];
            [myView addSubview:mineImageView];
            [mineImageView release];
            
            // 简介，人名
            UILabel *mineLabel = [[UILabel alloc] initWithFrame:CGRectMake(65, 0, 150, 50)];
            mineLabel.text = arrIntro[i];
            mineLabel.textAlignment = NSTextAlignmentLeft;
            [myView addSubview:mineLabel];
            [mineLabel release];
            
        }
     
        
        // 感谢外援
        UILabel *thankLabel = [[UILabel alloc] initWithFrame:CGRectMake(50, self.view.frame.size.height - 83, self.view.frame.size.width - 100, 20)];
        thankLabel.text = @"特别感谢";
        thankLabel.font = [UIFont boldSystemFontOfSize:18.f];
        thankLabel.textAlignment = NSTextAlignmentCenter;
        [self.view addSubview:thankLabel];
        [thankLabel release];
        
        // 感谢外援
        UILabel *thankContentLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, self.view.frame.size.height - 63, self.view.frame.size.width - 20, 63)];
        thankContentLabel.text = @"设计狮：魏文媛\n设计狮：刘畅";
        thankContentLabel.numberOfLines = 0;
        thankContentLabel.font = [UIFont systemFontOfSize:15];
        thankContentLabel.textAlignment = NSTextAlignmentCenter;
        [self.view addSubview:thankContentLabel];
        [thankContentLabel release];
        
    }
    

}


- (void)buttonClicked:(UIButton *)button
{
    [self dismissViewControllerAnimated:YES completion:^{
        
    }];
}
- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
